<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <title>修改线路</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="/assets/css/bootstrap.min.css" />
    <link rel="stylesheet" href="/assets/font-awesome/4.5.0/css/font-awesome.min.css" />

    <!-- page specific plugin styles -->

    <!-- text fonts -->
    <link rel="stylesheet" href="/assets/css/fonts.googleapis.com.css" />

    <!-- ace styles -->
    <link rel="stylesheet" href="/assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" />

    <!--[if lte IE 9]>
    <link rel="stylesheet" href="/assets/css/ace-part2.min.css" class="ace-main-stylesheet" />
    <![endif]-->
    <link rel="stylesheet" href="/assets/css/ace-skins.min.css" />
    <link rel="stylesheet" href="/assets/css/ace-rtl.min.css" />

    <!--[if lte IE 9]>
    <link rel="stylesheet" href="/assets/css/ace-ie.min.css" />
    <![endif]-->

    <!-- inline styles related to this page -->

    <!-- ace settings handler -->
    <script src="/assets/js/ace-extra.min.js"></script>

    <!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

    <!--[if lte IE 8]>
    <script src="/assets/js/html5shiv.min.js"></script>
    <script src="/assets/js/respond.min.js"></script>
    <![endif]-->

    <!--[if !IE]> -->
    <script src="/assets/js/jquery-2.1.4.min.js"></script>

    <!-- <![endif]-->

    <!--[if IE]>
    <script src="/assets/js/jquery-1.11.3.min.js"></script>
    <![endif]-->
    <script src="/assets/js/bootstrap.min.js"></script>

    <!-- page specific plugin scripts -->
    <script src="/assets/js/jquery.dataTables.min.js"></script>
    <script src="/assets/js/jquery.dataTables.bootstrap.min.js"></script>
    <script src="/assets/js/dataTables.buttons.min.js"></script>
    <script src="/assets/js/buttons.flash.min.js"></script>
    <script src="/assets/js/buttons.html5.min.js"></script>
    <script src="/assets/js/buttons.print.min.js"></script>
    <script src="/assets/js/buttons.colVis.min.js"></script>
    <script src="/assets/js/dataTables.select.min.js"></script>

    <!-- ace scripts -->
    <script src="/assets/js/ace-elements.min.js"></script>
    <script src="/assets/js/ace.min.js"></script>

    <script language="javascript" type="text/javascript" src="/js/My97DatePicker/WdatePicker.js"></script>

    <link href="/js/fileinput/css/fileinput.css" media="all" rel="stylesheet" type="text/css" />
    <script src="/js/fileinput/js/fileinput.js" type="text/javascript"></script>
    <script src="/js/fileinput/js/fileinput_locale_zh.js" type="text/javascript"></script>

</head>

<body class="no-skin">

<div th:replace="header :: navbar"></div>

<div class="main-container ace-save-state" id="main-container">
    <script type="text/javascript">
        try{ace.settings.loadState('main-container')}catch(e){}
    </script>

    <div th:replace="left :: sidebar"></div>

    <div class="main-content">
        <div class="main-content-inner">
            <div class="breadcrumbs ace-save-state" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li>
                        <i class="ace-icon fa fa-home home-icon"></i>
                        <a href="#">首页</a>
                    </li>

                    <li>
                        <a href="#">旅游</a>
                    </li>
                    <li class="active">遍辑旅游路线信息</li>
                </ul><!-- /.breadcrumb -->

            </div>

            <div class="page-content">
					<!-- TODO 回显数据 -->

                <form action="/admin/route/doUpdate" enctype="multipart/form-data" method="post">
                    <input hidden name="rid" th:value="${route.rid}">

                    <div class="form-group">
                        <label for="rName">线路名称：</label>
                        <input type="text" class="form-control" id="rName" name="rName" th:value="${route.rName}" placeholder="请输入线路名称" >
                    </div>

                    <div class="form-group">
                        <label for="routeIntroduce">线路介绍：</label>
                        <input type="text" class="form-control" id="routeIntroduce" name="routeIntroduce"
                               th:value="${route.routeIntroduce}"
                               placeholder="请输入线路介绍"  >
                    </div>

                    <div class="form-group">
                        <label for="cid">所属分类：</label>
                        <select class="form-control" id="cid" name="cid">
                            <option value=0>---请选择---</option>
                            <!-- TODO 回显数据 -->
                            <option th:each="c:${categories}" th:object="${c}"
                                    th:text="${c.cname}" th:value="${c.cid}"
                                    th:selected="${route.cid}==${c.cid}"></option>
                        </select>
                    </div>

                    <div class="form-group">
                        <label for="cid">旅游公司：</label>
                        <select class="form-control" id="sid" name="sid">
                            <option value=0>---请选择---</option>
                            <!-- TODO 回显数据-->
                            <option th:each="s:${sellers}" th:object="${s}"
                                    th:text="${s.sName}" th:value="${s.sid}"
                                    th:selected="${route.sid}==${s.sid}"></option>
                        </select>
                    </div>


                    <div class="form-group">
                        <label for="price">单价：</label>
                        <input type="text" class="form-control" name="price" id="price"
                               th:value="${route.price}"
                               placeholder="请输入单价"  />
                    </div>

                    <div class="form-group">
                        <label for="rimageFile">缩略图：</label>
                        <input id="rimageFile" name="rimageFile" type="file" data-min-file-count="1">
                    </div>

                    <div class="form-group" style="text-align: center">
                        <input class="btn btn-primary" type="submit" value="提交" />
                        <input class="btn btn-default" type="reset" value="重置" />
                        <a href="/admin/route/page" class="btn btn-default">返回</a>
                    </div>
                </form>

            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->

</div><!-- /.main-container -->

<!-- TODO 处理缩略图回显 -->
<script th:inline="javascript">
    $(function(){
        let rImage = "/" + [[${route.RImage}]];
        $("#rimageFile").fileinput({
            initialPreview: [
                "<img src='"+rImage+"' class='file-preview-image'>"
            ],
            overwriteInitial:true,
            maxFileSize: 10240
        });
    })
</script>
</body>
</html>
<!--输入框不为空验证-->
<script>

    $("#rName").blur(function (){
        let v1 = $("#rName").val();
        if (v1.trim() === "" ){
            alert("值不能为空！")
        }

    })

    $("#routeIntroduce").blur(function (){
        let v1 = $("#routeIntroduce").val();
        if (v1.trim() === "" ){
            alert("值不能为空！")
        }

    })

    $("#routeIntroduce").blur(function (){
        let v1 = $("#routeIntroduce").val();
        if (v1.trim() === "" ){
            alert("值不能为空！")
        }

    })

    $("#price").blur(function (){
        let v1 = $("#price").val();
        if (v1.trim() === "" ){
            alert("值不能为空！")
        }

    })

</script>